gtk-demo: Speed up image demo
authorMatthias Clasen <mclasen@redhat.com>
Thu, 22 Oct 2020 04:22:15 +0000 (00:22 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Thu, 22 Oct 2020 11:51:44 +0000 (07:51 -0400)
The progressive loading demo here was so slow as to appear
broken. Make it faster, and ensure that it updates regularly.

demos/gtk-demo/images.c

index e13302eb538092391e6cb0b687760c46b57ea750..22177a7f5cfefeda0070c7e25193e90f13d96ae5 100644 (file)
@@ -56,6 +56,7 @@ progressive_updated_callback (GdkPixbufLoader *loader,
   picture = GTK_WIDGET (data);
 
   pixbuf = gdk_pixbuf_loader_get_pixbuf (loader);
+  gtk_picture_set_pixbuf (GTK_PICTURE (picture), NULL);
   gtk_picture_set_pixbuf (GTK_PICTURE (picture), pixbuf);
 }
 
@@ -262,7 +263,7 @@ start_progressive_loading (GtkWidget *picture)
    * The timeout simply simulates a slow data source by inserting
    * pauses in the reading process.
    */
-  load_timeout = g_timeout_add (1500, progressive_timeout, picture);
+  load_timeout = g_timeout_add (300, progressive_timeout, picture);
   g_source_set_name_by_id (load_timeout, "[gtk] progressive_timeout");
 }